<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Systemadmin_user_model extends CI_Model {
	
	function __construct(){
        parent::__construct();
    }
    
	/**
	 * ��̨��½��֤
	 * @param string $user �û���
	 * @param string $password ����
	 * @return array/false
	 */
	function check_login($user = '', $password = ''){
		$password = md5(md5($password));
		$sql = "select id,adminname,type_id,status,login_time,login_ip from zjy_system_admin_user where status=1 and adminname='{$user}' and password='{$password}' limit 1";
		$query = $this->db->query($sql);
		if ($query->num_rows() > 0){
			return $query->row_array();
		}else{
			return false;
		}
	}

	/**
	 * ��ȡ����Ա����Ȩ��
	 * @param int ����Ա��ɫ����ID
	 * @return array/false
	 */
	function get_user_adminlist($typeid){
		$sql= "select name,module from zjy_system_admin_type where id='{$typeid}'";
		$query = $this->db->query($sql);
		if ($query->num_rows() > 0){
			return $query->row_array();
		}else{
			return false;
		}
	}

}

